package com.rightsidetech.system.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.rightsidetech.commom.base.ResponseData;
import com.rightsidetech.system.dtos.request.OperatorLogReq;
import com.rightsidetech.system.dtos.response.ModifyLogMethodResp;
import com.rightsidetech.system.dtos.response.ModifyLogNameResp;
import com.rightsidetech.system.dtos.response.OperatorLogResp;
import com.rightsidetech.system.mapper.SysOperatorLogMapper;
import com.rightsidetech.system.mapper.SysOperatorLogTempMapper;
import com.rightsidetech.system.service.SysOperatorLogService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: yhr
 * @Date: 2021-11-16 14:48
 */
@Service("sysOperatorLogServiceImpl")
public class SysOperatorLogServiceImpl implements SysOperatorLogService {
    @Resource
    private SysOperatorLogMapper sysOperatorLogMapper;
    @Resource
    private SysOperatorLogTempMapper sysOperatorLogTempMapper;

    @Override
    public ResponseData<PageInfo<OperatorLogResp>> page(OperatorLogReq req) {
        PageHelper.startPage(req.getPageNo(), req.getPageSize());
        List<OperatorLogResp> list = sysOperatorLogMapper.page(req);
        return ResponseData.success(new PageInfo<>(list));
    }

    @Override
    public ResponseData selectList() {
        List<ModifyLogNameResp> resps = sysOperatorLogMapper.selectList();
        return ResponseData.success(resps);
    }

    @Override
    public ResponseData selectMethodList(Byte type) {
        List<ModifyLogMethodResp> resps = sysOperatorLogTempMapper.selectMethodList(type);
        return ResponseData.success(resps);
    }
}
